<include file="Public/header"/>
<div class="x-body">
    <form class="layui-form" action="{:U('update')}" method="post">
        <div class="layui-form-item">
            <label for="username" class="layui-form-label">
                <span class="x-red"></span>所属线路
            </label>
            <div class="layui-input-inline" style="width:70%;">
                <select name="quyu_id">
                    <volist name="list" id="vo">
                        <option value="{$key}" <php>if($data['quyu_id'] == $key) echo 'selected'</php>>{$vo}</option>
                    </volist>

                </select>
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red"></span>
            </div>
        </div>
        <div class="layui-form-item">
            <label for="username" class="layui-form-label">
                <span class="x-red">*</span>小区名称
            </label>
            <div class="layui-input-inline" style="width:70%;">
                <input type="text" id="name" name="name" required="" lay-verify="required"
                       autocomplete="off" value="{$data['name']}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red"></span>
            </div>
        </div>
        <div class="layui-form-item">
            <label for="machine_code" class="layui-form-label">
                <span class="x-red">*</span>打印机编码
            </label>
            <div class="layui-input-inline" style="width:70%;">
                <input type="text" id="machine_code" name="machine_code" 
                       autocomplete="off" value="{$data['machine_code']}" class="layui-input"><!-- required="" lay-verify="required" -->
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red"></span>
            </div>
        </div>


        <div class="layui-form-item">
            <label for="desc" class="layui-form-label">
                <span class="x-red">*</span>自提点名称
            </label>
            <div class="layui-input-inline" style="width:70%;">
                <input type="text" id="shopname" required="" lay-verify="required" name="shopname"
                       autocomplete="off" value="{$data['shopname']}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red"></span>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="desc" class="layui-form-label">
                <span class="x-red">*</span>小区地址
            </label>
            <div class="layui-input-inline" style="width:70%;">
                <input type="text" id="address" required="" lay-verify="required" name="address"
                       autocomplete="off" value="{$data['address']}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red"></span>
            </div>
        </div>


        <div class="layui-form-item">
            <label for="desc" class="layui-form-label">
                <span class="x-red">*</span>小区纬度
            </label>
            <div class="layui-input-inline" style="width:70%;">
                <input type="number" id="lat" required="" lay-verify="required" name="lat"
                       autocomplete="off" value="{$data['lat']}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <a href="https://lbs.qq.com/tool/getpoint/" target="_blank">点击腾讯坐标拾取器</a>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="desc" class="layui-form-label">
                <span class="x-red">*</span>小区经度
            </label>
            <div class="layui-input-inline" style="width:70%;">
                <input type="number" id="lng" required="" lay-verify="required" name="lng"
                       autocomplete="off" value="{$data['lng']}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <a href="https://lbs.qq.com/tool/getpoint/">点击腾讯坐标拾取器</a>
            </div>
        </div>


        <div class="layui-form-item">
            <label for="desc" class="layui-form-label">
                <span class="x-red">*</span>团长id
            </label>
            <div class="layui-input-inline" style="width:60%;">
                <input type="number" id="uid" required=""  lay-verify="required" name="uid"
                       autocomplete="off" value="{$data['uid']|default=0}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">	
            	<button type='button' onclick="showhhr()" class="layui-btn layui-btn-xs layui-btn-normal">选择团长</button>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="tuan_name" class="layui-form-label">
                <span class="x-red">*</span>团长姓名
            </label>
            <div class="layui-input-inline" style="width:70%;">
                <input type="text" id="tuan_name" required="" lay-verify="required"  name="tuan_name"
                       autocomplete="off" value="{$data['tuan_name']}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="tuan_name" class="layui-form-label">
                <span class="x-red">*</span>团长微信昵称
            </label>
            <div class="layui-input-inline" style="width:70%;">
                <input type="text" id="tuan_nickname" required="" lay-verify="required"  name="tuan_nickname"
                       autocomplete="off" value="{$data['tuan_nickname']}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="mobile" class="layui-form-label">
                <span class="x-red">*</span>团长手机号
            </label>
            <div class="layui-input-inline" style="width:70%;">
                <input type="text" id="mobile"  name="mobile" required="" lay-verify="required" 
                       autocomplete="off" value="{$data['mobile']}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="username" class="layui-form-label">
                <span class="x-red"></span>小区状态
            </label>
            <div class="layui-input-inline" style="width:70%;">
                <select name="status">
                        <option value="1" <php>if($data['status'] == 1) echo 'selected'</php>>正常</option>
                        <option value="2" <php>if($data['status'] == 2) echo 'selected'</php>>禁用</option>

                </select>
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red"></span>
            </div>
        </div>


        <div class="layui-form-item">
            <label for="username" class="layui-form-label">
                <span class="x-red"></span>配送类型
            </label>
            <div class="layui-input-inline" style="width:70%;">
                <select name="peisong_type">
                    <option value="1" <php>if($data['peisong_type'] == 1) echo 'selected'</php>>自提</option>
                    <option value="2" <php>if($data['peisong_type'] == 2) echo 'selected'</php>>送货上门</option>
                    <option value="3" <php>if($data['peisong_type'] == 3) echo 'selected'</php>>不限</option>

                </select>
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red"></span>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="desc" class="layui-form-label">
                <span class="x-red">*</span>配送金额
            </label>
            <div class="layui-input-inline" style="width:70%;">
                <input type="number" id="peisong_jiner"  name="peisong_jiner" required="" lay-verify="required" 
                       autocomplete="off" value="{$data['peisong_jiner']|default=0}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">单位:元
            </div>
        </div>
<!-- 
        <div class="layui-form-item"> 
			<label for="zititime" class="layui-form-label"> <span class="x-red">*</span>自提时间            </label>
			<div class="layui-input-inline" style="width:70%;">
				<input type="text" id="zititime"  name="zititime" placeholder="自提时间"   required="" lay-verify="required" 
				autocomplete="off" value="<if condition='$data.id neq 0'>{$data['zititime']|date='Y-m-d H:i:s',###}</if>" class="layui-input">
			</div>
			<div class="layui-form-mid layui-word-aux"></div>
		</div>
 -->
        <div class="layui-form-item">
			<label for="fensi" class="layui-form-label"> <span class="x-red">*</span>粉丝数  </label>
			<div class="layui-input-inline" style="width:70%;">
				<input type="number" id="fensi"  name="fensi"  required="" lay-verify="required" 
				autocomplete="off" value="<if condition='$data.fensi eq 0'>{:mt_rand(4000,5000)}<else/>{$data['fensi']}</if>" class="layui-input">
			</div>
			<div class="layui-form-mid layui-word-aux"></div>
		</div>
        <div class="layui-form-item">
			<label for="goumaizhishu" class="layui-form-label"> <span class="x-red">*</span>购买指数</label>
			<div class="layui-input-inline" style="width:70%;">
				<input type="number" id="goumaizhishu"  name="goumaizhishu" required="" lay-verify="required" 
				autocomplete="off" value="<if condition='$data.goumaizhishu eq 0'>{:mt_rand(90,99)}<else/>{$data['goumaizhishu']}</if>" class="layui-input">
			</div>
			<div class="layui-form-mid layui-word-aux"></div>
		</div>
		
		<input type="hidden" name="id"  value="{$data['id']}">
        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="submit" lay-submit="submit">
                保存
            </button>
        </div>
    </form>
</div>
<script>
	layui.use('laydate', function(){
		var laydate = layui.laydate;
		laydate.render({
			 elem: '#zititime', //指定元素
			 type:'datetime'
		});
	});

    layui.use('upload', function(){
        var $ = layui.jquery

        var upload = layui.upload;

        //执行实例
        var uploadInst = upload.render({
            elem: '#avatar-btn'
            ,url: "{:U('Upload/uploadpic')}"
            ,data:{
                name:'img'

            }
            ,field:'img'
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#avatar-preview').attr('src', result); //图片链接（base64）
                });
            }
            ,done: function(res){


                if(res.code!=0){
                    layer.msg(res.msg,{icon: 5});

                }
                //上传成功
                if(res.code==0 ){
                    layer.msg('上传成功',{icon: 6});
                    $("[name='icon']").val(res.data);
                }

            }
            ,error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
        });
    });
	function showhhr(){
		layer.open({
			title:['选择团长'],
			type: 2,
			area: ['900px', '700px'],
			fixed: false, //不固定
			maxmin:true,
			content: '{:U("user")}'
		});
	}
</script>
<include file="Public/footer"/>